<!--
- @founder   IT柏拉图, https: //weibo.com/itprato
- @author    DedeCMS团队
- @copyright Copyright (c) 2007 - 2021, 上海卓卓网络科技有限公司 (DesDev, Inc.)
--->

<html>
<head>
<meta charset="{dede:global.cfg_soft_lang/}" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>增加字段</title>
<meta name="copyright" content="2007-2021 DedeCMS, 上海卓卓网络科技有限公司 (DesDev, Inc.)" />
<link rel="icon" href="/favicon.ico" />
<!-- CSS FILES -->
<link rel="stylesheet" type="text/css" href="{dede:global.cfg_assets_dir/}/pkg/uikit/css/uikit.min.css" />
<link rel="stylesheet" type="text/css" href="{dede:global.cfg_assets_dir/}/css/manage.dede.css">
<style type="text/css">
.uk-table td{
padding: 6px 12px;
vertical-align: top;
height: 35px;
}
</style>
</head>
<body>
<!-- 列表头部 -->
<div id="Table_Header_202X2W2X1X292F" class="uk-card uk-card-small uk-card-default" uk-sticky="bottom: #offset">
<div id="Header_1W2T2S2T1V252B" class="uk-card-header">
<div class="uk-grid uk-grid-small uk-text-small">
<span><ul class="uk-breadcrumb"><li><a href="member_model_main.php">用户模型管理</a></li><li><a href="member_model_edit.php?id=<?=$id;?>&dopost=edit">当前模型</a></li><li><span>增加字段</span></li></ul></span>
</div>
</div>
</div>
<!-- /列表头部 -->
<!-- 列表主体 -->
<div class="uk-card uk-card-small uk-card-default" style="top:-20px;margin-bottom: 50px;">
<div class="uk-card-body uk-overflow-auto" grid>
<div class="uk-child-width-1-1 uk-padding">
<table width="98%" border="0" cellpadding="1" cellspacing="1" class="uk-table">
<form name="form1" action="member_model_field_add.php" method="post" onSubmit="return GetFields();">
<input type='hidden' name='action' value='save'>
<input type='hidden' name='id' value='<?php echo $id?>'>
<input type='hidden' name='fieldstring' value=''>
<!-- 选项 -->
<tr>
<td>提示文字：</td>
<td><input name="itemname" type="text" id="itemname" class="uk-input uk-form-small uk-form-width-large"/><br/>
* 注册修改时显示的提示文字</td>
</tr>
<tr>
<td width="18%">字段名称：</td>
<td><input name="fieldname" type="text" id="fieldname" class="uk-input uk-form-small uk-form-width-large"/><br/>
* 只能用英文字母或数字，数据表的真实字段名，如果数据类型是联动类型，该项应该填写联动类型的<a href='stepselect_main.php' target='_blank'><u>[组名称]</u></a>。</td>
</tr>
<tr>
<td>数据类型：</td>
<td>
<select name="dtype" id="dtype" class="uk-select uk-form-small uk-form-width-large">
<option value="text" checked='1'> 单行文本(varchar)</option>
<option value="textchar"> 单行文本(char)</option>
<option value="multitext"> 多行文本</option>
<option value="htmltext"> HTML文本</option>
<option value="int"> 整数类型</option>
<option value="float"> 小数类型</option>
<option value="datetime"> 时间类型</option>
<option value="select"> 使用option下拉框</option>
<option value="radio"> 使用radio选项卡</option>
<option value="checkbox"> Checkbox多选框</option>
<option value="img"> 图片</option>
<option value="addon"> 附件类型</option>
</select>
</tr>
<tr>
<td>默认值：</td>
<td>
<input name="isnull" type="hidden" value="1" />
<textarea name="vdefault" type="text" id="vdefault" style="height:60px" class="uk-textarea uk-form-small uk-form-width-large"></textarea><br/>
如果定义数据类型为select、radio、checkbox时，此处填写被选择的项目(用“,”分开，如“男,女”)。
</td>
</tr>
<tr>
<td>最大长度：</td>
<td><input name="maxlength" type="text" id="maxlength" class="uk-input uk-form-small uk-form-width-small" value="250"/> * 文本数据必须填写，大于255为text类型</td>
</tr>
<tr>
<td>会员模型表单HTML：</td>
<td>自定义表单HTML模板中用~name~表示提示文字，~form~表示表单元素。 </td>
</tr>
<tr>
<td></td>
<td><textarea name="vinnertext" cols="45" rows="5" id="vinnertext" style="height:120px;" class="uk-textarea uk-form-small uk-form-width-large"></textarea></td>
</tr>
<tr>
<td>作为搜索条件：</td>
<td><input name="issearch" type="radio" class="uk-radio" value="1" /> 是 &nbsp;&nbsp;
<input name="issearch" type="radio" class="uk-radio" value="0" checked /> 否
</td>
</tr>
<tr>
<td>是否在前台会员相关页面中显示：</td>
<td><input name="isshow" type="radio" class="uk-radio" value="1" /> 是 &nbsp;&nbsp;
<input name="isshow" type="radio" class="uk-radio" value="0" checked /> 否
</td>
</tr>
<tr>
<td>字段状态：</td>
<td><input name="state" type="radio" class="uk-radio" value="1" checked /> 启用 &nbsp;&nbsp;
<input name="state" type="radio" class="uk-radio" value="0" /> 禁用
</td>
</tr>
<!-- /选项 -->
</table>
</div>
</div>
<div class="uk-card-footer " >
<div class="uk-padding-small" >
<button type="submit" class="uk-button uk-button-small uk-button-primary">提交</button>
</div>
</div>
</div>
</form>
<!-- 列表底部 -->
<div class="bar-bottom uk-flex uk-light uk-flex-right">
<div class="uk-button-group" style="margin-left: 50px;">
</div>
<div class="e1e02">Copyright &copy; 2007-2021 <a href='http://www.dedecms.com' target='_blank'><u>DedeCMS</u></a>, 上海卓卓网络科技有限公司 (DesDev, Inc.)</div>
</div>
<!-- 列表底部 -->
<!-- JS FILES -->
<script src="{dede:global.cfg_assets_dir/}/pkg/uikit/js/uikit.min.js"></script>
<script src="{dede:global.cfg_assets_dir/}/pkg/uikit/js/uikit-icons.min.js"></script>
<script src="{dede:global.cfg_assets_dir/}/pkg/jquery/jquery.min.js"></script>
<script src="{dede:global.cfg_assets_dir/}/js/dede.manage.min.js"></script>
<script language="javascript">
var notAllow = " <?php echo $f; ?> ";
function GetFields()
{
var theform = document.form1;
var fieldname = theform.fieldname.value;
var itemname = theform.itemname.value;
var dtype = 'text';
var enums = document.getElementsByName('dtype');
for(i=0;i<enums.length;i++)
{
if(enums[i].checked) dtype = enums[i].value;
}
var isnull = theform.isnull.value;
var vdefault = theform.vdefault.value;
var maxlength = theform.maxlength.value;
var vinnertext = theform.vinnertext.value;
var issearch = (theform.issearch[0].checked ? theform.issearch[0].value : theform.issearch[1].value);
var isshow = (theform.isshow[0].checked ? theform.isshow[0].value : theform.isshow[1].value);
var state = (theform.state[0].checked ? theform.state[0].value : theform.state[1].value);
var sisnull = (isnull==0 ? "false" : "true");
if(itemname=="")
{
alert("表单提示名称不能为空！");
theform.itemname.focus();
return false;
}
if(fieldname=="")
{
alert("字段名称不能为空！");
theform.fieldname.focus();
return false;
}
if(notAllow.indexOf(" "+fieldname+" ") >-1 )
{
alert("字段名称不合法，如下字段名已经存在，建议在名称后加上数字以区分：\n"+notAllow);
return false;
}
if((dtype=="radio" || dtype=="select" || dtype=="checkbox") && vdefault=="")
{
alert("你选择的select或radio、checkbox类型，必须默认值设置选择的项目（用逗号[,]分开）！");
return false;
}
revalue = "<field:"+fieldname+" itemname=\""+itemname+"\" autofield=\"1\" type=\""+dtype+"\" isnull=\""+sisnull+"\"";
revalue += " default=\""+vdefault+"\" ";
revalue += " maxlength=\""+maxlength+"\" issearch=\""+issearch+"\" isshow=\""+isshow+"\" state=\""+state+"\">\r\n"+vinnertext+"</field:"+fieldname+">\r\n";
document.form1.fieldstring.value = revalue;
return true;
}
</script>
<!-- / JS FILES -->
</body>
</html>
